package com.xyzwps.orm.exposed.repository

import com.xyzwps.orm.model.Tag
import org.jetbrains.exposed.dao.IntEntity
import org.jetbrains.exposed.dao.IntEntityClass
import org.jetbrains.exposed.dao.id.EntityID

class TagEntity(id: EntityID<Int>) : IntEntity(id) {
    companion object : IntEntityClass<TagEntity>(TagTable)

    var tagId by TagTable.id
    var userId by TagTable.userId
    var tagName by TagTable.tagName

    fun toTag(): Tag {
        val tag = Tag()
        tag.tagId = this.tagId.value
        tag.tagName = this.tagName
        tag.userId = this.userId
        return tag
    }
}